<?xml version="1.0" encoding="utf-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <start>
    <element name="library">
      <a:documentation>Root element. Describes the whole library.</a:documentation>
      <zeroOrMore>
        <element name="book">
          <a:documentation>Describes a book.</a:documentation>
          <attribute name="id">
            <a:documentation>Identifier</a:documentation>
            <data type="token"/>
          </attribute>
          <attribute name="available">
            <a:documentation>Is the book available?</a:documentation>
            <data type="boolean"/>
          </attribute>
          <element name="isbn">
            <a:documentation>ISBN number</a:documentation>
            <data type="token"/>
          </element>
          <element name="title">
            <a:documentation>Title of the book</a:documentation>
            <data type="token"/>
            <attribute name="xml:lang">
              <a:documentation>Language</a:documentation>
              <data type="language"/>
            </attribute>
          </element>
          <zeroOrMore>
            <element name="author">
              <a:documentation>Author of a book</a:documentation>
              <attribute name="id">
                <a:documentation>Identifier</a:documentation>
                <data type="token"/>
              </attribute>
              <element name="name">
                <a:documentation>Name</a:documentation>
                <data type="token"/>
              </element>
              <element name="born">
                <a:documentation>Date of birth</a:documentation>
                <data type="date"/>
              </element>
              <element name="dead">
                <a:documentation>Date of death</a:documentation>
                <data type="date"/>
              </element>
            </element>
          </zeroOrMore>
          <zeroOrMore>
            <element name="character">
              <a:documentation>Character of a book</a:documentation>
              <attribute name="id">
                <a:documentation>Identifier</a:documentation>
                <data type="token"/>
              </attribute>
              <element name="name">
                <a:documentation>Name</a:documentation>
                <data type="token"/>
              </element>
              <element name="born">
                <a:documentation>Date of birth</a:documentation>
                <data type="date"/>
              </element>
              <element name="qualification">
                <a:documentation>Qualification of a character</a:documentation>
                <data type="token"/>
              </element>
            </element>
          </zeroOrMore>
        </element>
      </zeroOrMore>
    </element>
  </start>
</grammar>
